home *** CD-ROM | disk | FTP | other *** search
/ ftp.cs.arizona.edu / ftp.cs.arizona.edu.tar / ftp.cs.arizona.edu / icon / newsgrp / group97a.txt / 000118_icon-group-sender _Wed Apr 16 00:13:55 1997.msg < prev    next >
Internet Message Format  |  2000-09-20  |  1KB

  1. Received: from kingfisher.CS.Arizona.EDU by cheltenham.cs.arizona.edu; Wed, 16 Apr 1997 16:57:00 MST
  2. Received: by kingfisher.CS.Arizona.EDU; (5.65v3.2/1.1.8.2/08Nov94-0446PM)
  3.     id AA02428; Wed, 16 Apr 1997 16:57:00 -0700
  4. Date: Wed, 16 Apr 1997 00:13:55 GMT
  5. From: ia@stryx.demon.co.uk (Iain Alexander)
  6. Reply-To: ia@stryx.demon.co.uk
  7. Message-Id: <19729@stryx.demon.co.uk>
  8. To: icon-group@cs.arizona.edu
  9. Subject: Re: Records in Icon
  10. X-Mailer: PCElm 1.10
  11. Lines: 27
  12. Errors-To: icon-group-errors@cs.arizona.edu
  13. Status: RO
  14. Content-Length: 815
  15.  
  16. A further thought:
  17. In message <334E5509.2A4@gemini.edu> Steve Wampler writes:
  18. > Do you care why the two records 'match'?  That is, do you need to
  19. > distinguish between your two example cases, or is it sufficient to
  20. > simply say "the records 'match'"?
  21. > Here's a procedure that handles the latter case:
  22. > procedure weakMatch(r1,r2)
  23. >     return !r1 ~=== !r2
  24. > end
  25.  
  26. If you want a bit more information about which items matched,
  27. I think you can do something like
  28.  
  29. procedure indexMatch(l1, l2)
  30.     if l1[i:= 1 to *l1] === l2[j:= 1 to *l2]
  31.     then return [i, j]
  32. end
  33.  
  34. (and if you wanted to allow for multiple matches, you could
  35. change it to
  36.     suspend l1[i:= 1 to *l1] === l2[j:= 1 to *l2] & [i, j]
  37. )
  38. -- 
  39. Iain Alexander               PGP 1024-bit key id B501A0AD
  40. ia@stryx.demon.co.uk   I.Alexander@bsn0106.wins.icl.co.uk
  41.